<?php

namespace App\Http\Requests\Api;

use Illuminate\Foundation\Http\FormRequest;

class UpdateUserRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array<string, mixed>
     */
    public function rules()
    {
        $userId = auth('api')->id();
        return [
            "name" => 'required|between:2,200|unique:users,name,'.$userId,
            'introduction' => 'max:200',
            'image_avatar_id'=>'exists:images,id,type,avatar,user_id,'.$userId
        ];
    }
}
